package com.shop.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shop.bean.Products;
import com.shop.dao.ProductsDAO;
import com.shop.factory.ProductsDAOFactory;

public class SelectProductsServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request,response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ProductsDAO pd = ProductsDAOFactory.createProductsDAOImpl();
		List<Products> pl = pd.findAllProducts();
		request.setAttribute("pl",pl);
		request.getRequestDispatcher("AllProducts.jsp").forward(request, response);
	}

}
